/* 返回页面顶部 */
export const BACK_TOP = ()=>document.getElementById("wrapper").scrollTop = 0;

/**
 * 获取桥梁分结构类型评定的数据
 * @param xAxisData   坐标轴数据
 * @param seriesData  系列数据，二维数组
 * @return {{tooltip: {show: boolean, confine: boolean, trigger: string, axisPointer: {type: string, axis: string}}, legend: {x: string, top: string, data: [string,string,string,string,string]}, grid: {left: string, top: string, bottom: string, containLabel: boolean}, xAxis: {type: string, data: *, axisLabel: {interval: number, rotate: number}}, yAxis: {type: string}, series: [null,null,null,null,null]}}
 */
export const getEvaluationColumnChartsOptions = (xAxisData, seriesData)=>{
  return {
    //系列默认颜色
    color:['#c4ccd3','#61a0a8', '#d48265','#ca8622','#c23531','#2f4554', '#91c7ae','#749f83', '#bda29a','#6e7074'],
    tooltip : {
      show:true,
      confine:true,
      trigger: 'axis',
      axisPointer:{
        type:"shadow",
        axis:"x"
      }
    },
    legend: {
      x: '25%',
      top: '1%',
      data: ['一类', '二类', '三类', '四类', '五类']
    },
    grid: {
      left: '0%',
      top: "13%",
      bottom: "12%",
      containLabel: true
    },
    xAxis: {
      type: 'category',
      data: xAxisData,
      axisLabel: {
        interval: 0,
        rotate: 20
      }
    },
    yAxis: {type: 'value'},
    series:[
      {
        name: '一类',
        type: 'bar',
        stack: '桥梁总数',
        data: seriesData[0]
      }, {
        name: '二类',
        type: 'bar',
        stack: '桥梁总数',
        data: seriesData[1]
      }, {
        name: '三类',
        type: 'bar',
        stack: '桥梁总数',
        data: seriesData[2]
      }, {
        name: '四类',
        type: 'bar',
        stack: '桥梁总数',
        data: seriesData[3]
      }, {
        name: '五类',
        type: 'bar',
        stack: '桥梁总数',
        data: seriesData[4]
      }
    ]
  }
};

/**
 * 获取雷达图的数据
 * @param bridgeCount       桥梁总数
 * @param seriesData        系列数据, 二维数组
 * @return {{tooltip: {trigger: string, confine: boolean, backgroundColor: string}, legend: {bottom: number, data: [string,string,string,string]}, radar: {indicator: [null,null,null,null,null], radius: number, center: [string,string]}, series: [null,null,null,null]}}
 */
export const getEvaluationRadarChartsOption = (bridgeCount, seriesData)=>{
  return {
    tooltip: {
      trigger: 'item',
      confine:true,
      backgroundColor: "rgba(0,0,250,0.36)"
    },
    legend: {
      bottom: 0,
      data: ["<10年", "[10, 20)年", "[20, 30)年", ">=30年"]
    },
    radar: {
      indicator : [
        { text: '一类', max: bridgeCount},
        { text: '二类', max: bridgeCount},
        { text: '三类', max: bridgeCount},
        { text: '四类', max: bridgeCount},
        { text: '五类', max: bridgeCount}
      ],
      radius:80,
      center:["50%", "50%"]
    },
    series: [{
      name:"<10年",
      type:"radar",
      itemStyle:{
        emphasis:{areaStyle:{color:"rgba(0,250,0,0.3)"}}
      },
      data:[
        {
          name:"<10年",
          value:seriesData[0]
        }
      ]
    }, {
      name:"[10, 20)年",
      type:"radar",
      itemStyle:{
        emphasis:{areaStyle:{color:"rgba(0,250,0,0.3)"}}
      },
      data:[
        {
          name:"[10, 20)年",
          value:seriesData[1]
        }
      ]
    }, {
      name:"[20, 30)年",
      type:"radar",
      itemStyle:{
        emphasis:{areaStyle:{color:"rgba(0,250,0,0.3)"}}
      },
      data:[
        {
          name:"[20, 30)年",
          value:seriesData[2]
        }
      ]
    }, {
      name:">=30年",
      type:"radar",
      itemStyle:{
        emphasis:{areaStyle:{color:"rgba(0,250,0,0.3)"}}
      },
      data:[
        {
          name:">=30年",
          value:seriesData[3]
        }
      ]
    }]
  }
};

export const getTreatmentCostChartsOptions = (treatmentTypeList, costList)=>{
  return {
    title : {
      text: '处治费用统计图'
    },
    tooltip : {
      trigger: 'axis'
    },
    toolbox: {
      show : true,
      feature : {
        dataView : {show: true, readOnly: false},
        magicType : {show: true, type: ['line', 'bar']},
        restore : {show: true},
        saveAsImage : {show: true}
      }
    },
    grid: {
      top:"12%",
      left: '2%',
      right: '2%',
      bottom: '2%',
      containLabel: true
    },
    calculable : true,
    xAxis : [
      {
        type : 'category',
        data : treatmentTypeList
      }
    ],
    yAxis : [
      {
        type : 'value'
      }
    ],
    series : [
      {
        name:'处治费用',
        type:'bar',
        data:costList,
        itemStyle:{
          normal:{
            color:"#2f4554"
          }
        },
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        },
        markLine : {
          data : [
            {type : 'average', name: '平均值'}
          ]
        }
      }
    ]
  };
};

export const getBridgeCostChartsOptions = (bridgeNameList, costList) => {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    grid: {
      top:"5%",
      left: '2%',
      right: '2%',
      bottom: '2%',
      containLabel: true
    },
    xAxis: {
      type: 'value',
      boundaryGap: [0, 0.01]
    },
    yAxis: {
      type: 'category',
      data: bridgeNameList
    },
    series: [
      {
        name: '处治费用',
        type: 'bar',
        data: costList
      }
    ]
  };
};

/** 获取桥梁历史技术状况等级发展情况 */
export const getEvaluationTrendChartsOptions = (evaluationList)=>{
  let evaluationDates = [];
  evaluationList.forEach(item=>{
    if(!evaluationDates.includes(item.evaluationDate)) {
      evaluationDates.push(item.evaluationDate);
    }
  });
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        crossStyle: {
          color: '#999'
        }
      },
    },
    toolbox: {
      feature: {
        dataView: {show: true, readOnly: false},
        magicType: {show: true, type: ['line', 'bar']},
        restore: {show: true},
        saveAsImage: {show: true}
      }
    },
    legend: {
      data:['1类','2类','3类', "4类", "5类"]
    },
    xAxis: {
      type: 'category',
      data: evaluationDates,
      axisPointer: {
        type: 'shadow'
      },
      axisLabel: {
        rotate: 20
      }
    },
    yAxis: {
      type: 'value',
      name: '桥梁座数',
      axisLabel: {
        formatter: '{value} 座'
      },
      minInterval:1
    },
    grid: {
      top:"15%",
      left: '2%',
      right: '2%',
      bottom: '2%',
      containLabel: true
    },
    series: [
      {
        name:'1类',
        type:'bar',
        data:evaluationList.filter(item=>item.bridgeLevel === 1).map(item=>[item.evaluationDate, item.bridgeCount]),
      },
      {
        name:'2类',
        type:'bar',
        data:evaluationList.filter(item=>item.bridgeLevel === 2).map(item=>[item.evaluationDate, item.bridgeCount]),
      },
      {
        name:'3类',
        type:'bar',
        data:evaluationList.filter(item=>item.bridgeLevel === 3).map(item=>[item.evaluationDate, item.bridgeCount]),
      },
      {
        name:'4类',
        type:'bar',
        data:evaluationList.filter(item=>item.bridgeLevel === 4).map(item=>[item.evaluationDate, item.bridgeCount]),
      },
      {
        name:'5类',
        type:'bar',
        data:evaluationList.filter(item=>item.bridgeLevel === 5).map(item=>[item.evaluationDate, item.bridgeCount]),
      }
    ]
  };
};

/** 获取单桥历史等级 */
export const getSingleEvaluationTrendChartsOptions = (evaluationList) => {
  let evaluationDates = [];
  evaluationList.forEach(item=>{
    if(!evaluationDates.includes(item.createDate)) {
      evaluationDates.push(item.createDate);
    }
  });
  return {
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data:['总体','上部结构','下部结构','桥面系']
    },
    toolbox: {
      show: true,
      feature: {
        dataZoom: {
          yAxisIndex: 'none'
        },
        dataView: {readOnly: false},
        magicType: {type: ['line', 'bar']},
        restore: {},
        saveAsImage: {}
      }
    },
    xAxis:  {
      type: 'category',
      boundaryGap: false,
      data: evaluationDates
    },
    yAxis: {
      type: 'value',
      axisLabel: {
        formatter: '{value} 分'
      }
    },
    visualMap: {
      show:false,
      pieces: [{
        gt: 0,
        lte: 40,
        color: '#cc0033'
      }, {
        gt: 40,
        lte: 60,
        color: '#096'
      }, {
        gt: 60,
        lte: 80,
        color: '#ff9933'
      }, {
        gt: 80,
        lte: 95,
        color: '#ffde33'
      }, {
        gt: 95,
        lte: 100,
        color: '#ffde33'
      }],
      outOfRange: {
        color: '#999'
      }
    },
    series: [
      {
        name:'总体',
        type:'line',
        data:evaluationList.map(item=>item.sidePoint),
        markPoint: {
          data: [
            {type: 'max', name: '最大值'},
            {type: 'min', name: '最小值'}
          ]
        }
      },
      {
        name:'上部结构',
        type:'line',
        data:evaluationList.map(item=>item.superPoint),
        markPoint: {
          data: [
            {type: 'max', name: '最大值'},
            {type: 'min', name: '最小值'}
          ]
        },
        markLine: {
          silent: true,
          data: [{
            yAxis: 40,
          }, {
            yAxis: 60,
          }, {
            yAxis: 80,
          }, {
            yAxis: 95,
          }]
        }
      },
      {
        name:'下部结构',
        type:'line',
        data:evaluationList.map(item=>item.subPoint),
        markPoint: {
          data: [
            {type: 'max', name: '最大值'},
            {type: 'min', name: '最小值'}
          ]
        }
      },
      {
        name:'桥面系',
        type:'line',
        data:evaluationList.map(item=>item.deckPoint),
        markPoint: {
          data: [
            {type: 'max', name: '最大值'},
            {type: 'min', name: '最小值'}
          ]
        }
      }
    ]
  };
};

/** 获取病害数量统计图表 */
export const getDiseaseCountChartsOptions = function(pieData) {
  return {
    tooltip : {
      trigger: 'item',
      formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    calculable : true,
    series : [{
      name:'病害数量',
      type:'pie',
      radius : '80%',
      center: ['50%', '50%'],
      roseType : 'radius',
      data:pieData.sort(function (a, b) { return a.value - b.value; })
    }]
  };
};

/** 获取病害统计柱形图 */
export const getDiseaseCountColumnChartsOption = function(pieData) {
  let axisData = pieData.map(d=>d.name);
  let data = pieData.map(d=>d.value);
  return {
    tooltip : {
      trigger: 'axis'
    },
    calculable : true,
    grid: {
      top:"15%",
      left: '5%',
      right: '5%',
      bottom: '5%',
      containLabel: true
    },
    xAxis : [
      {
        type : 'category',
        data : axisData,
        interval:1,
        axisPointer: {
          type: 'shadow'
        },
        axisLabel: {
          rotate: 90
        }
      }
    ],
    yAxis : [{
      type : 'value'
    }],
    series : [
      {
        name:'病害数量',
        type:'bar',
        data:data,
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        }
      }
    ]
  };
};

/** 获取长度最大跨统计图 */
export const getSpanLengthLevelChartsOption = function(data) {
  let seriesData1 = data[0].map(d=>[d.x, d.y]);
  let seriesData2 = data[1].map(d=>[d.x, d.y]);
  let sum1 = 0;
  let sum2 = 0;
  seriesData1.forEach(arr=>sum1 += arr[0]);
  seriesData2.forEach(arr=>sum2 += arr[1]);
  let avg1 = 0;
  let avg2 = 0;
  if(seriesData1.length > 0) avg1 = sum1 / seriesData1.length;
  if(seriesData2.length > 0) avg2 = sum2 / seriesData2.length;
  //返回结果
  return {
    grid: {
      left: '2%',
      right: '7%',
      bottom: '3%',
      containLabel: true
    },
    tooltip : {
      // trigger: 'axis',
      showDelay : 0,
      formatter : function (params) {
        if (params.value.length > 1) {
          return params.seriesName + ' :<br/>'
            + params.value[0] + 'm '
            + params.value[1] + '分 ';
        }
      },
      axisPointer:{
        show: true,
        type : 'cross',
        lineStyle: {
          type : 'dashed',
          width : 1
        }
      }
    },
    toolbox: {
      feature: {
        dataZoom: {},
        brush: {
          type: ['rect', 'polygon', 'clear']
        }
      }
    },
    brush: {
    },
    legend: {
      data: ['按最大跨径','按桥长'],
      left: 'center'
    },
    xAxis : [
      {
        type : 'value',
        scale:true,
        axisLabel : {
          formatter: '{value} m'
        },
        splitLine: {
          show: false
        }
      }
    ],
    yAxis : [
      {
        type : 'value',
        scale:true,
        max:100,
        min:0,
        axisLabel : {
          formatter: '{value} 分'
        },
        splitLine: {
          show: false
        }
      }
    ],
    series : [
      {
        name:'按最大跨径',
        type:'scatter',
        data: seriesData1,
        markArea: {
          silent: true,
          itemStyle: {
            normal: {
              color: 'transparent',
              borderWidth: 1,
              borderType: 'dashed'
            }
          },
          data: [[{
            name: '按最大跨径分布区间',
            xAxis: 'min',
            yAxis: 'min'
          }, {
            xAxis: 'max',
            yAxis: 'max'
          }]]
        },
        markLine : {
          lineStyle: {
            normal: {
              type: 'solid'
            }
          },
          data : [
            {xAxis:avg1}
          ]
        }
      },
      {
        name:'按桥长',
        type:'scatter',
        data: seriesData2,
        markArea: {
          silent: true,
          itemStyle: {
            normal: {
              color: 'transparent',
              borderWidth: 1,
              borderType: 'dashed'
            }
          },
          data: [[{
            name: '按桥长分布',
            xAxis: 'min',
            yAxis: 'min'
          }, {
            xAxis: 'max',
            yAxis: 'max'
          }]]
        },
        markLine : {
          lineStyle: {
            normal: {
              type: 'solid'
            }
          },
          data : [
            {xAxis:avg2}
          ]
        }
      }
    ]
  };
};

export const getAgeLevelChartsOption = function(data) {
  return {
    grid: {
      left: '2%',
      right: '7%',
      bottom: '3%',
      top:"10%",
      containLabel: true
    },
    tooltip: {
      trigger: 'cross',
      axisPointer: {
        type: 'cross'
      }
    },
    xAxis: {
      type: 'value',
      splitLine: {
        show: true
      },
      scale: true,
      splitNumber: 5,
      max: 'dataMax',
      axisLabel: {
        formatter: function (val) {
          return val + '年';
        }
      }
    },
    yAxis: {
      type: 'value',
      min: 0,
      max: 100,
      name: '技术状况得分',
      splitLine: {
        show: true
      }
    },
    series: [{
      name: '桥龄, 评分',
      type: 'scatter',
      symbolSize: function (val, param) {
        return 20 - val[1] * 0.1;
      },
      itemStyle: {
        normal: {
          color: function (param) {
            return getRandomColor(param.dataIndex);
          }
        }
      },
      data: data.map(d=>[d.x, d.y])
    }]
  }
};

export const getMapLevelChartsOption = function(data) {
  return {
    title: {
      text: '桥梁按技术状况等级分布图',
      subtext: '仅以入库数据统计',
      left: 'center'
    },
    tooltip : {
      trigger: 'item'
    },
    bmap: {
      // 百度地图中心经纬度
      center: [119.601669,32.014374],
      // 百度地图缩放
      zoom: 10,
      roam: true,
      mapStyle: {
        styleJson:[
          {
            "featureType": "land",
            "elementType": "geometry",
            "stylers": {
              "color": "#e7f7fc"
            }
          },
          {
            "featureType": "water",
            "elementType": "all",
            "stylers": {
              "color": "#96b5d6"
            }
          },
          {
            "featureType": "green",
            "elementType": "all",
            "stylers": {
              "color": "#b0d3dd"
            }
          },
          {
            "featureType": "highway",
            "elementType": "geometry.fill",
            "stylers": {
              "color": "#a6cfcf"
            }
          },
          {
            "featureType": "highway",
            "elementType": "geometry.stroke",
            "stylers": {
              "color": "#7dabb3"
            }
          },
          {
            "featureType": "arterial",
            "elementType": "geometry.fill",
            "stylers": {
              "color": "#e7f7fc"
            }
          },
          {
            "featureType": "arterial",
            "elementType": "geometry.stroke",
            "stylers": {
              "color": "#b0d5d4"
            }
          },
          {
            "featureType": "local",
            "elementType": "labels.text.fill",
            "stylers": {
              "color": "#7a959a"
            }
          },
          {
            "featureType": "local",
            "elementType": "labels.text.stroke",
            "stylers": {
              "color": "#d6e4e5"
            }
          },
          {
            "featureType": "arterial",
            "elementType": "labels.text.fill",
            "stylers": {
              "color": "#374a46"
            }
          },
          {
            "featureType": "highway",
            "elementType": "labels.text.fill",
            "stylers": {
              "color": "#374a46"
            }
          },
          {
            "featureType": "highway",
            "elementType": "labels.text.stroke",
            "stylers": {
              "color": "#e9eeed"
            }
          }
        ]
      }
    },
    series : [
      {
        name: '1、2类桥梁',
        type: 'scatter',
        coordinateSystem: 'bmap',
        data: data.filter(d=>d.value >= 80).map(d=>{
          return {name:d.name, value:[d.longitude, d.latitude, d.value]};
        }),
        symbolSize: function (val) {
          return 15;
        },
        tooltip:{
          formatter: function (params, ticket, callback) {
            return params.data.name + ": " + params.data.value[2] + "分";
          }
        },
        label: {
          normal: {
            formatter: '{b}',
            position: 'right',
            show: false
          },
          emphasis: {
            show: true
          }
        },
        itemStyle: {
          normal: {
            color: 'purple'
          }
        }
      },
      {
        name: '三类及以上桥梁',
        type: 'effectScatter',
        coordinateSystem: 'bmap',
        data: data.filter(d=>d.value < 80).map(d=>{
          return {name:d.name, value:[d.longitude, d.latitude, d.point]};
        }),
        symbolSize: function (val) {
          return (100 - val[2]) / 1.5;
        },
        tooltip:{
          formatter: function (params, ticket, callback) {
            return params.data.name + ": " + params.data.value[2] + "分";
          }
        },
        showEffectOn: 'render',
        rippleEffect: {
          brushType: 'stroke'
        },
        hoverAnimation: true,
        label: {
          normal: {
            formatter: '{b}',
            position: 'right',
            show: false
          }
        },
        itemStyle: {
          normal: {
            color: 'purple',
            shadowBlur: 10,
            shadowColor: '#333'
          }
        },
        zlevel: 1
      }
    ]
  }
};

/** 获取评定等级与桥龄的统计图 */
export const getBridgeAgeLevelChartsOption = function(data) {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    legend: {
      data : ['1类','2类', '3类', '4类', '5类']
    },
    toolbox: {
      show : true,
      feature : {
        dataView : {show: true, readOnly: false},
        magicType : {show: true, type: ['line', 'bar']},
        restore : {show: true},
        saveAsImage : {show: true}
      }
    },
    calculable : true,
    xAxis : [
      {
        type : 'category',
        data:['桥龄>=30年','桥龄20～30年', '桥龄10～20年', '桥龄<10年']
      }
    ],
    yAxis : [{
      type : 'value'
    }],
    series : [
      {
        name:'1类',
        type:'bar',
        data:[data[0].lessThanTen, data[0].lessThanTwenty, data[0].lessThanThirty, data[0].moreThanThirty],
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        }
      },
      {
        name:'2类',
        type:'bar',
        data:[data[1].lessThanTen, data[1].lessThanTwenty, data[1].lessThanThirty, data[1].moreThanThirty],
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        }
      },
      {
        name:'3类',
        type:'bar',
        data:[data[2].lessThanTen, data[2].lessThanTwenty, data[2].lessThanThirty, data[2].moreThanThirty],
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        }
      },
      {
        name:'4类',
        type:'bar',
        data:[data[3].lessThanTen, data[3].lessThanTwenty, data[3].lessThanThirty, data[3].moreThanThirty],
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        }
      },
      {
        name:'5类',
        type:'bar',
        data:[data[4].lessThanTen, data[4].lessThanTwenty, data[4].lessThanThirty, data[4].moreThanThirty],
        markPoint : {
          data : [
            {type : 'max', name: '最大值'},
            {type : 'min', name: '最小值'}
          ]
        }
      }
    ]
  }
};

/** 获取结构类型分类统计图 */
export const getStructureTypeChartsOption = function(data) {
  let arr = [];
  if(!!data.beamBridgeCount) arr.push({name:"梁式桥", value:data.beamBridgeCount});
  if(!!data.arcOneBridgeCount) arr.push({name:"板拱桥、肋拱桥、箱形拱桥、双曲拱桥", value:data.arcOneBridgeCount});
  if(!!data.arcTwoBridgeCount) arr.push({name:"刚架拱桥、桁架拱桥", value:data.arcTwoBridgeCount});
  if(!!data.tiedArcBridgeCount) arr.push({name:"钢-混凝土组合拱桥", value:data.tiedArcBridgeCount});
  if(!!data.susBridgeCount) arr.push({name:"悬索桥", value:data.susBridgeCount});
  if(!!data.cableBridgeCount) arr.push({name:"斜拉桥", value:data.cableBridgeCount});

  return {
    tooltip : {
      trigger: 'item',
      formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    calculable : true,
    series : [
      {
        name:'结构类型分布',
        type:'pie',
        center : ['50%', '50%'],
        data:arr
      }
    ]

  }
};

/** 桥龄统计图 */
export const getBridgeAgeStatOption = function(data) {
  let arr = [];
  if(!!data.lessThanTen) arr.push({name:"桥龄<10年", value:data.lessThanTen});
  if(!!data.lessThanTwenty) arr.push({name:"桥龄10～20年", value:data.lessThanTwenty});
  if(!!data.lessThanThirty) arr.push({name:"桥龄20～30年", value:data.lessThanThirty});
  if(!!data.moreThanThirty) arr.push({name:"桥龄>=30年", value:data.moreThanThirty});

  return {
    tooltip : {
      trigger: 'item',
      formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    calculable : true,
    series : [
      {
        name:'桥龄分布',
        type:'pie',
        center : ['50%', '50%'],
        roseType : 'area',
        data:arr
      }
    ]

  }
};

/** 桥梁等级分布 */
export const getBridgeLevelChartsOption = function(data) {
  let arr = [];
  if(!!data.levelOneCount) arr.push({name:"一类桥", value:data.levelOneCount});
  if(!!data.levelTwoCount) arr.push({name:"二类桥", value:data.levelTwoCount});
  if(!!data.levelThreeCount) arr.push({name:"三类桥", value:data.levelThreeCount});
  if(!!data.levelFourCount) arr.push({name:"四类桥", value:data.levelFourCount});
  if(!!data.levelFiveCount) arr.push({name:"五类桥", value:data.levelFiveCount});

  return {
    tooltip : {
      trigger: 'item',
      formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    calculable : true,
    series : [
      {
        name:'技术状况等级分布',
        type:'pie',
        center : ['50%', '50%'],
        roseType : 'area',
        data:arr
      }
    ]
  }
};

/** 获取随机颜色 */
function getRandomColor(index) {
  let colors = ["#a3864a", "#33221e", "#674032",
    "#755645", "#665744", "#c3b69d", "#8a683d",
    "#ded8ce", "#d7bb96", "#9a785c", "#6b593d",
    "#5f4c45", "#b69d8a", "#674133", "#dacebb",
    "#d6b6a2", "#2d2625", "#d9c2aa", "#382d27",
    "#382f2b", "#635048", "#473832", "#796557",
    "#e4d4b8", "#88867a", "#ad7260", "#ab9575",
    "#d49e75", "#b38d67", "#463129", "#dac7a5",
    "#908d7e", "#51332a", "#aea18b", "#c4b28c",
    "#3d231b", "#8f6347", "#17090c", "#a57b54",
    "#200c0c", "#d9cec4", "#2e1b1c", "#d0b895",
    "#2e1814", "#415463", "#524a3f", "#765a4e",
    "#805047", "#8c766c", "#c0ac95", "#aba496",
    "#3a191e", "#b9a19a", "#4b2726", "#ac826b",
    "#a39588", "#736256", "#987c5f", "#7b584c",
    "#e9d9bc", "#fcfcfc", "#6e5236", "#846448",
    "#0c0604", "#6e5735", "#27150b", "#703326",
    "#b3805a", "#858399", "#8f7357", "#b39472",
    "#c9a06f", "#85613f", "#9b7442", "#251e1b",
    "#9c7f4d", "#dadeb9", "#9bd2d2", "#b5ab94",
    "#8b786b", "#ca8a81", "#847868", "#c3b39c",
    "#68463e", "#a69485", "#7c7b7d", "#c1b5a6",
    "#96867a", "#666664", "#72544b", "#9c8c83",
    "#917163", "#513b38", "#987e6b", "#987968",
    "#af9f92", "#61636a", "#a4978a", "#4e3e41"];
  return colors[colors.length % index];
};

/** 获取随机大小 */
function getRandomSize() {
  return Math.random() * 20
}



// WEBPACK FOOTER //
// ./src/assets/js/utils/ViewUtils.js